package dataProviders;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;

import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;

import wrappers.*;

public class DataTypeComboBox implements ComboBoxModel{
	Set<ListDataListener> ldl = new HashSet<ListDataListener>();
	ArrayList<DataType> types = new ArrayList<DataType>();
	Object selected = null;
	
	public void setDataTypes(ArrayList<DataType> input){
		types = input;
	}
	
	@Override
	public void addListDataListener(ListDataListener arg0) {
		ldl.add(arg0);
		
	}

	@Override
	public Object getElementAt(int arg0) {
		return types.get(arg0).getErdType();
	}

	@Override
	public int getSize() {
		return types.size();
	}

	@Override
	public void removeListDataListener(ListDataListener arg0) {
		ldl.remove(arg0);		
	}

	@Override
	public Object getSelectedItem() {
		return selected;
	}

	@Override
	public void setSelectedItem(Object arg0) {
		selected = arg0;
		System.out.println(selected.toString());
		
	}

}
